public class equalsdemo {
    private int age;
    private String name;

    public equalsdemo(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        equalsdemo that = (equalsdemo) o;

        if (age != that.age) return false;
        return name != null ? name.equals(that.name) : that.name == null;
    }



}
